#  Gmof - A meta-object facility library based on OMG's EMOF 
#
#  Copyright (C) 2007 Peter Hagg <peter.hagg@iki.fi>
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
import unittest
from gmof.Package import Package
from gmof.Enumeration import Enumeration

class PackageTest(unittest.TestCase):
    
    def setUp(self):
        self.package = Package("Test", "com.google.code.gmof.test")
        
    def tearDown(self):
        del self.package
        
    def testCreation(self):
        """Test that the Package gets properly created and initialized"""
        self.assertTrue(self.package != None)
        self.assertEquals("Test", self.package.name)
        self.assertEquals("com.google.code.gmof.test", self.package.uri)
        
    def testOwnedType(self):
        """Test that Elements get properly linked as owned types for Package"""
        enum = Enumeration("TestEnumeration")
        self.package.ownedType.append(enum)
        enum.package = self.package
        
        self.assertEquals(1, len(self.package.ownedType))
        self.assertEquals(self.package, enum.package)
        
